<!DOCTYPE html>
<html lang="en" ng-app="MyApp" ng-controller="MyController">

<head>
    <meta charset="UTF-8">
    <title>学习表达式解析</title>
    <link rel="stylesheet" type="text/css" href="../bootstrap-3.3.4/css/bootstrap.css">
</head>

<body>
    <div class="container">
        <div class="row">
            <div class="col-md-12">
                <div class="panel panel-primary">
                    <div class="panel-heading">测试{{title}}表达式</div>
                    <div class="panel-body">
                        <form class="form-horizontal">
                            <div class="form-group">
                                <label class="col-md-2 control-lable">表达式</label>
                                <div class="col-md-10">
                                    <input type="text" class="form-control" ng-model="expression">
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-md-offset-2 col-md-10">
                                    <buttom class="btn btn-default" type="submit" ng-click="runExpression(expression,'title')">计算</buttom>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-md-2 control-lable">结果：</label>
                                <div class="col-md-10">
                                    {{value}}
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script src="angular.min.js"></script>
    <script type="text/javascript">
    var app = angular.module("MyApp", []);
    app.controller("MyController", function($scope, $parse, $http) {
        // var context = {
        //     name: "dreamapple",
        //     a: 'a'
        // };

        // $scope.runExpression = function(expr, value) {
        //     var parseFunc = $parse(expr);
        //     $scope[value] = parseFunc(context);
        // }

        var url = "http://fcprocess.stable.mayibank.net/plugin/FcbuserviceTestScript?callback=JSON_CALLBACK";
        $http.jsonp(url,{data:{"args":["yaoqiang.yq","yq"]}})
            .success(function(data) {
                console.log(data.content);
            });

    });
    </script>
</body>

</html>
